package com.harisucici.websocketlib.entities.send;


import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Embedded;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

@Entity
public class P2PSendHoleEntity {
    @PrimaryKey(autoGenerate = true)
    @NonNull
    private long id;
    /**
     * toAccount : {"accountId":"2019123123412","nickName":"昵称","avatarImg":"http://123.jpg","shortName":"简称"}
     * payLoad : {"content":"我们可以聊天了"}
     * cmdType : P2P
     * fromAccount : {"accountId":"2019123123412","nickName":"昵称","avatarImg":"http://123.jpg","shortName":"简称"}
     */
    @Embedded
    private ToAccountEntity toAccount;
    @Embedded
    private P2PSend payLoad;
    private String cmdType;
    @Embedded
    private FromAccountEntity fromAccount;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public ToAccountEntity getToAccount() {
        return toAccount;
    }

    public void setToAccount(ToAccountEntity toAccount) {
        this.toAccount = toAccount;
    }

    public P2PSend getPayLoad() {
        return payLoad;
    }

    public void setPayLoad(P2PSend payLoad) {
        this.payLoad = payLoad;
    }

    public String getCmdType() {
        return cmdType;
    }

    public void setCmdType(String cmdType) {
        this.cmdType = cmdType;
    }

    public FromAccountEntity getFromAccount() {
        return fromAccount;
    }

    public void setFromAccount(FromAccountEntity fromAccount) {
        this.fromAccount = fromAccount;
    }

    @Entity
    public static class ToAccountEntity {
//        @PrimaryKey(autoGenerate = true)
//        @NonNull
//        @ColumnInfo(name = "fromId")
//        private long id;
//
//        public long getId() {
//            return id;
//        }
//
//        public void setId(long id) {
//            this.id = id;
//        }

        /**
         * accountId : 2019123123412
         * nickName : 昵称
         * avatarImg : http://123.jpg
         * shortName : 简称
         */
        @ColumnInfo(name = "fromAccID")
        private String accountId;
        @ColumnInfo(name = "fromName")
        private String nickName;
        @ColumnInfo(name = "fromImg")
        private String avatarImg;
        @ColumnInfo(name = "fromsName")
        private String shortName;

        public String getAccountId() {
            return accountId;
        }

        public void setAccountId(String accountId) {
            this.accountId = accountId;
        }

        public String getNickName() {
            return nickName;
        }

        public void setNickName(String nickName) {
            this.nickName = nickName;
        }

        public String getAvatarImg() {
            return avatarImg;
        }

        public void setAvatarImg(String avatarImg) {
            this.avatarImg = avatarImg;
        }

        public String getShortName() {
            return shortName;
        }

        public void setShortName(String shortName) {
            this.shortName = shortName;
        }
    }

    @Entity
    public static class FromAccountEntity {
//        @PrimaryKey(autoGenerate = true)
//        @NonNull
//        @ColumnInfo(name = "toId")
//        private long id;
//
//        public long getId() {
//            return id;
//        }
//
//        public void setId(long id) {
//            this.id = id;
//        }

        /**
         * accountId : 2019123123412
         * nickName : 昵称
         * avatarImg : http://123.jpg
         * shortName : 简称
         */
        @ColumnInfo(name = "toAccID")
        private String accountId;
        @ColumnInfo(name = "toName")
        private String nickName;
        @ColumnInfo(name = "toImg")
        private String avatarImg;
        @ColumnInfo(name = "tosName")
        private String shortName;

        public String getAccountId() {
            return accountId;
        }

        public void setAccountId(String accountId) {
            this.accountId = accountId;
        }

        public String getNickName() {
            return nickName;
        }

        public void setNickName(String nickName) {
            this.nickName = nickName;
        }

        public String getAvatarImg() {
            return avatarImg;
        }

        public void setAvatarImg(String avatarImg) {
            this.avatarImg = avatarImg;
        }

        public String getShortName() {
            return shortName;
        }

        public void setShortName(String shortName) {
            this.shortName = shortName;
        }
    }
}
